#!/usr/bin/env python
#coding=utf-8
import dbus
import gobject
import dbus.glib
from time  import sleep
import threading
import locale, sys

server="org.scim.frontend"
path="/org/scim/frontend"
interface="org.scim.frontend"
class Method_input_manager(object):
    def __init__(self):
        self.bus = dbus.SessionBus()
        self.language, self.encoding=locale.getdefaultlocale()
        self.proxy = dbus.Interface(self.bus.get_object(server, path), interface)
  
    def new_instance(self, uuid, encoding=''):
        if not encoding:
            encoding=self.encoding
        id=self.proxy.new_instance(uuid, encoding)
        if id!=-1:
            return Method_input_instance(id, self.proxy)
    
    def get_factory_list_for_encoding(self, encoding=''):
        if not encoding:
            encoding=self.encoding
        uuids, n=self.proxy.get_factory_list_for_encoding(encoding)
        return uuids
    
    def get_factory_list_for_language(self, language=''):
        if not language:
            language=self.language
        uuids, n=self.proxy.get_factory_list_for_language(language)
        return uuids
    
    def get_default_factory(self, language='', encoding=''):
        if not encoding:
            encoding=self.encoding
        if not language:
            language=self.language
        return self.proxy.get_default_factory(language, encoding)
    
    def get_next_factory(self, uuid, language='', encoding=''):
        if not encoding:
            encoding=self.encoding
        if not language:
            language=self.language
        return self.proxy.get_next_factory(language, encoding, uuid)
    
    def get_previous_factory(self, uuid, language='', encoding=''):
        if not encoding:
            encoding=self.encoding
        if not language:
            language=self.language
        return self.proxy.get_previous_factory(language, encoding, uuid)
    def get_factory_name(self, uuid):
        return self.proxy.get_factory_name(uuid)
    
    def get_factory_authors(self, uuid):
        return self.proxy.get_factory_authors(uuid)
    
    def get_factory_credits(self, uuid):
        return self.proxy.get_factory_credits(uuid)
    
    def get_factory_help(self, uuid):
        return self.proxy.get_factory_help(uuid)
    
    def get_factory_icon_file(self, uuid):
        return self.proxy.get_factory_icon_file(uuid)
    
    def get_factory_locales(self, uuid):
        return self.proxy.get_factory_locales(uuid)
    
    def get_factory_language(self, uuid):
        return self.proxy.get_factory_language(uuid)
    
    def validate_factory(self, uuid, encoding=''):
        if not encoding:
            encoding=self.encoding
        return self.proxy.validate_factory(uuid, encoding)
    
signales=[
          'show_preedit_string',
          'show_aux_string',
          'show_lookup_table',
          'hide_preedit_string',
          'hide_aux_string',
          'hide_lookup_table',
          'update_preedit_caret',
          'update_preedit_string',
          'update_aux_string',
          'update_lookup_table',
          'commit_string',
          'forward_key_event',
          'beep'
          ]    
class Method_input_instance(object):
    def __init__(self, id, proxy):
        self.id=id; 
        self.proxy=proxy
        self.signal_listeners=[]
        self.__regsister_signal()

        
    def __regsister_signal(self):
        for signal_name in signales:
            try:
                method=getattr(self, '%s'%(signal_name,))
                if callable(method):
                    self.proxy.connect_to_signal(signal_name, method)
                    #self.bus.add_signal_receiver(method, dbus_interface=interface, signal_name=signal_name)
            except Exception, e:pass
    def add_signal_listener(self, l):
        self.signal_listeners.append(l)
        
    def remove_signal_listener(self, l):
        self.signal_listeners.remove(l)
        
    def replace(self, uuid):
        self.proxy.replace_instance(self.id, uuid)
        
    def get_uuid(self):
        return self.proxy.get_instance_uuid(self.id)
    
    def get_encoding(self):
        return self.proxy.get_instance_encoding(self.id)
    
    def get_name(self):
        return self.proxy.get_instance_name(self.id)
    
    def get_authors(self):
        return self.proxy.get_instance_authors(self.id)
    
    def get_credits(self):
        return self.proxy.get_instance_credits(self.id)
    
    def get_help(self):
        return self.proxy.get_instance_help(self.id)
    
    def get_icon_file(self):
        return self.proxy.get_instance_icon_file(self.id)
    
    def process_key_event(self, key):
        return self.proxy.process_key_event(self.id, key)
    
    def move_preedit_caret(self, pos):
        return self.proxy.move_preedit_caret(self.id, pos)
    
    def select_candidate(self, index):
        self.proxy.select_candidate(self.id, index)
        
    def update_lookup_table_page_size(self, page_size):
        self.proxy.update_lookup_table_page_size(self.id, page_size)
    
    def lookup_table_page_up(self):
        self.proxy.lookup_table_page_up(self.id)
        
    def lookup_table_page_down(self):
        self.proxy.lookup_table_page_down(self.id)
    
    def reset(self):
        self.proxy.reset(self.id)

    def focus_in(self):
        self.proxy.focus_in(self.id)

        
    def focus_out(self):
        self.proxy.focus_out(self.id)
        
        
    def close(self):
        if self.id!=-1:
            self.proxy.delete_instance(self.id)
            self.id=-1
            
    def __del__(self):
        self.close()
        
    def __getattr__(self,name):   
        def call_listener(id,*args):
            if id==self.id:
                for l in self.signal_listeners:
                    try:
                        method=getattr(l, name);
                        if callable(method):
                            method(*args) 
                    except Exception,e:
                        print e   
        if name in signales:
            return call_listener    

        
class Sample_listener(object):
    def printargs(self,*args):
        print args
    def __getattr__(self,name):
        print 'Call',name,
        return self.printargs        
 
key_name_map={
   0x0030: "0" ,
   0x0031: "1" ,
   0x0032: "2" ,
   0x0033: "3" ,
   0xFD10: "3270_AltCursor" ,
   0xFD0E: "3270_Attn" ,
   0xFD05: "3270_BackTab" ,
   0xFD19: "3270_ChangeScreen" ,
   0xFD15: "3270_Copy" ,
   0xFD0F: "3270_CursorBlink" ,
   0xFD1C: "3270_CursorSelect" ,
   0xFD1A: "3270_DeleteWord" ,
   0xFD01: "3270_Duplicate" ,
   0xFD1E: "3270_Enter" ,
   0xFD06: "3270_EraseEOF" ,
   0xFD07: "3270_EraseInput" ,
   0xFD1B: "3270_ExSelect" ,
   0xFD02: "3270_FieldMark" ,
   0xFD13: "3270_Ident" ,
   0xFD12: "3270_Jump" ,
   0xFD11: "3270_KeyClick" ,
   0xFD04: "3270_Left2" ,
   0xFD0A: "3270_PA1" ,
   0xFD0B: "3270_PA2" ,
   0xFD0C: "3270_PA3" ,
   0xFD16: "3270_Play" ,
   0xFD1D: "3270_PrintScreen" ,
   0xFD09: "3270_Quit" ,
   0xFD18: "3270_Record" ,
   0xFD08: "3270_Reset" ,
   0xFD03: "3270_Right2" ,
   0xFD14: "3270_Rule" ,
   0xFD17: "3270_Setup" ,
   0xFD0D: "3270_Test" ,
   0x0034: "4" ,
   0x0035: "5" ,
   0x0036: "6" ,
   0x0037: "7" ,
   0x0038: "8" ,
   0x0039: "9" ,
   0x0041: "A" ,
   0x00C6: "AE" ,
   0x00C1: "Aacute" ,
   0x01C3: "Abreve" ,
   0xFE70: "AccessX_Enable" ,
   0xFE71: "AccessX_Feedback_Enable" ,
   0x00C2: "Acircumflex" ,
   0x00C4: "Adiaeresis" ,
   0x00C0: "Agrave" ,
   0xFFE9: "Alt_L" ,
   0xFFEA: "Alt_R" ,
   0x03C0: "Amacron" ,
   0x01A1: "Aogonek" ,
   0x05D9: "Arabic_ain" ,
   0x05C7: "Arabic_alef" ,
   0x05E9: "Arabic_alefmaksura" ,
   0x05C8: "Arabic_beh" ,
   0x05AC: "Arabic_comma" ,
   0x05D6: "Arabic_dad" ,
   0x05CF: "Arabic_dal" ,
   0x05EF: "Arabic_damma" ,
   0x05EC: "Arabic_dammatan" ,
   0x05EE: "Arabic_fatha" ,
   0x05EB: "Arabic_fathatan" ,
   0x05E1: "Arabic_feh" ,
   0x05DA: "Arabic_ghain" ,
   0x05E7: "Arabic_ha" ,
   0x05CD: "Arabic_hah" ,
   0x05C1: "Arabic_hamza" ,
   0x05C3: "Arabic_hamzaonalef" ,
   0x05C4: "Arabic_hamzaonwaw" ,
   0x05C6: "Arabic_hamzaonyeh" ,
   0x05C5: "Arabic_hamzaunderalef" ,
   0x05E7: "Arabic_heh" ,
   0x05CC: "Arabic_jeem" ,
   0x05E3: "Arabic_kaf" ,
   0x05F0: "Arabic_kasra" ,
   0x05ED: "Arabic_kasratan" ,
   0x05CE: "Arabic_khah" ,
   0x05E4: "Arabic_lam" ,
   0x05C2: "Arabic_maddaonalef" ,
   0x05E5: "Arabic_meem" ,
   0x05E6: "Arabic_noon" ,
   0x05E2: "Arabic_qaf" ,
   0x05BF: "Arabic_question_mark" ,
   0x05D1: "Arabic_ra" ,
   0x05D5: "Arabic_sad" ,
   0x05D3: "Arabic_seen" ,
   0x05BB: "Arabic_semicolon" ,
   0x05F1: "Arabic_shadda" ,
   0x05D4: "Arabic_sheen" ,
   0x05F2: "Arabic_sukun" ,
   0xFF7E: "Arabic_switch" ,
   0x05D7: "Arabic_tah" ,
   0x05E0: "Arabic_tatweel" ,
   0x05CA: "Arabic_teh" ,
   0x05C9: "Arabic_tehmarbuta" ,
   0x05D0: "Arabic_thal" ,
   0x05CB: "Arabic_theh" ,
   0x05E8: "Arabic_waw" ,
   0x05EA: "Arabic_yeh" ,
   0x05D8: "Arabic_zah" ,
   0x05D2: "Arabic_zain" ,
   0x00C5: "Aring" ,
   0x00C3: "Atilde" ,
   0xFE7A: "AudibleBell_Enable" ,
   0x0042: "B" ,
   0xFF08: "BackSpace" ,
   0xFF58: "Begin" ,
   0xFE74: "BounceKeys_Enable" ,
   0xFF6B: "Break" ,
   0x06BE: "Byelorussian_SHORTU" ,
   0x06AE: "Byelorussian_shortu" ,
   0x0043: "C" ,
   0x02C5: "Cabovedot" ,
   0x01C6: "Cacute" ,
   0xFF69: "Cancel" ,
   0xFFE5: "Caps_Lock" ,
   0x01C8: "Ccaron" ,
   0x00C7: "Ccedilla" ,
   0x02C6: "Ccircumflex" ,
   0xFF0B: "Clear" ,
   0xFF37: "Codeinput" ,
   0x20A1: "ColonSign" ,
   0xFFE3: "Control_L" ,
   0xFFE4: "Control_R" ,
   0x20A2: "CruzeiroSign" ,
   0x06E1: "Cyrillic_A" ,
   0x06E2: "Cyrillic_BE" ,
   0x06FE: "Cyrillic_CHE" ,
   0x06E4: "Cyrillic_DE" ,
   0x06BF: "Cyrillic_DZHE" ,
   0x06FC: "Cyrillic_E" ,
   0x06E6: "Cyrillic_EF" ,
   0x06EC: "Cyrillic_EL" ,
   0x06ED: "Cyrillic_EM" ,
   0x06EE: "Cyrillic_EN" ,
   0x06F2: "Cyrillic_ER" ,
   0x06F3: "Cyrillic_ES" ,
   0x06E7: "Cyrillic_GHE" ,
   0x06E8: "Cyrillic_HA" ,
   0x06FF: "Cyrillic_HARDSIGN" ,
   0x06E9: "Cyrillic_I" ,
   0x06E5: "Cyrillic_IE" ,
   0x06B3: "Cyrillic_IO" ,
   0x06B8: "Cyrillic_JE" ,
   0x06EB: "Cyrillic_KA" ,
   0x06B9: "Cyrillic_LJE" ,
   0x06BA: "Cyrillic_NJE" ,
   0x06EF: "Cyrillic_O" ,
   0x06F0: "Cyrillic_PE" ,
   0x06FB: "Cyrillic_SHA" ,
   0x06FD: "Cyrillic_SHCHA" ,
   0x06EA: "Cyrillic_SHORTI" ,
   0x06F8: "Cyrillic_SOFTSIGN" ,
   0x06F4: "Cyrillic_TE" ,
   0x06E3: "Cyrillic_TSE" ,
   0x06F5: "Cyrillic_U" ,
   0x06F7: "Cyrillic_VE" ,
   0x06F1: "Cyrillic_YA" ,
   0x06F9: "Cyrillic_YERU" ,
   0x06E0: "Cyrillic_YU" ,
   0x06FA: "Cyrillic_ZE" ,
   0x06F6: "Cyrillic_ZHE" ,
   0x06C1: "Cyrillic_a" ,
   0x06C2: "Cyrillic_be" ,
   0x06DE: "Cyrillic_che" ,
   0x06C4: "Cyrillic_de" ,
   0x06AF: "Cyrillic_dzhe" ,
   0x06DC: "Cyrillic_e" ,
   0x06C6: "Cyrillic_ef" ,
   0x06CC: "Cyrillic_el" ,
   0x06CD: "Cyrillic_em" ,
   0x06CE: "Cyrillic_en" ,
   0x06D2: "Cyrillic_er" ,
   0x06D3: "Cyrillic_es" ,
   0x06C7: "Cyrillic_ghe" ,
   0x06C8: "Cyrillic_ha" ,
   0x06DF: "Cyrillic_hardsign" ,
   0x06C9: "Cyrillic_i" ,
   0x06C5: "Cyrillic_ie" ,
   0x06A3: "Cyrillic_io" ,
   0x06A8: "Cyrillic_je" ,
   0x06CB: "Cyrillic_ka" ,
   0x06A9: "Cyrillic_lje" ,
   0x06AA: "Cyrillic_nje" ,
   0x06CF: "Cyrillic_o" ,
   0x06D0: "Cyrillic_pe" ,
   0x06DB: "Cyrillic_sha" ,
   0x06DD: "Cyrillic_shcha" ,
   0x06CA: "Cyrillic_shorti" ,
   0x06D8: "Cyrillic_softsign" ,
   0x06D4: "Cyrillic_te" ,
   0x06C3: "Cyrillic_tse" ,
   0x06D5: "Cyrillic_u" ,
   0x06D7: "Cyrillic_ve" ,
   0x06D1: "Cyrillic_ya" ,
   0x06D9: "Cyrillic_yeru" ,
   0x06C0: "Cyrillic_yu" ,
   0x06DA: "Cyrillic_ze" ,
   0x06D6: "Cyrillic_zhe" ,
   0x0044: "D" ,
   0x01CF: "Dcaron" ,
   0xFFFF: "Delete" ,
   0x20AB: "DongSign" ,
   0xFF54: "Down" ,
   0x01D0: "Dstroke" ,
   0x0045: "E" ,
   0x03BD: "ENG" ,
   0x00D0: "ETH" ,
   0x03CC: "Eabovedot" ,
   0x00C9: "Eacute" ,
   0x01CC: "Ecaron" ,
   0x00CA: "Ecircumflex" ,
   0x20A0: "EcuSign" ,
   0x00CB: "Ediaeresis" ,
   0x00C8: "Egrave" ,
   0xFF2F: "Eisu_Shift" ,
   0xFF30: "Eisu_toggle" ,
   0x03AA: "Emacron" ,
   0xFF57: "End" ,
   0x01CA: "Eogonek" ,
   0xFF1B: "Escape" ,
   0x00D0: "Eth" ,
   0x20AC: "EuroSign" ,
   0xFF62: "Execute" ,
   0x0046: "F" ,
   0xFFBE: "F1" ,
   0xFFC7: "F10" ,
   0xFFC8: "F11" ,
   0xFFC9: "F12" ,
   0xFFCA: "F13" ,
   0xFFCB: "F14" ,
   0xFFCC: "F15" ,
   0xFFCD: "F16" ,
   0xFFCE: "F17" ,
   0xFFCF: "F18" ,
   0xFFD0: "F19" ,
   0xFFBF: "F2" ,
   0xFFD1: "F20" ,
   0xFFD2: "F21" ,
   0xFFD3: "F22" ,
   0xFFD4: "F23" ,
   0xFFD5: "F24" ,
   0xFFD6: "F25" ,
   0xFFD7: "F26" ,
   0xFFD8: "F27" ,
   0xFFD9: "F28" ,
   0xFFDA: "F29" ,
   0xFFC0: "F3" ,
   0xFFDB: "F30" ,
   0xFFDC: "F31" ,
   0xFFDD: "F32" ,
   0xFFDE: "F33" ,
   0xFFDF: "F34" ,
   0xFFE0: "F35" ,
   0xFFC1: "F4" ,
   0xFFC2: "F5" ,
   0xFFC3: "F6" ,
   0xFFC4: "F7" ,
   0xFFC5: "F8" ,
   0xFFC6: "F9" ,
   0x20A3: "FFrancSign" ,
   0xFF68: "Find" ,
   0xFED0: "First_Virtual_Screen" ,
   0x0047: "G" ,
   0x02D5: "Gabovedot" ,
   0x02AB: "Gbreve" ,
   0x03AB: "Gcedilla" ,
   0x02D8: "Gcircumflex" ,
   0x07C1: "Greek_ALPHA" ,
   0x07A1: "Greek_ALPHAaccent" ,
   0x07C2: "Greek_BETA" ,
   0x07D7: "Greek_CHI" ,
   0x07C4: "Greek_DELTA" ,
   0x07C5: "Greek_EPSILON" ,
   0x07A2: "Greek_EPSILONaccent" ,
   0x07C7: "Greek_ETA" ,
   0x07A3: "Greek_ETAaccent" ,
   0x07C3: "Greek_GAMMA" ,
   0x07C9: "Greek_IOTA" ,
   0x07A4: "Greek_IOTAaccent" ,
   0x07A5: "Greek_IOTAdiaeresis" ,
   0x07CA: "Greek_KAPPA" ,
   0x07CB: "Greek_LAMBDA" ,
   0x07CB: "Greek_LAMDA" ,
   0x07CC: "Greek_MU" ,
   0x07CD: "Greek_NU" ,
   0x07D9: "Greek_OMEGA" ,
   0x07AB: "Greek_OMEGAaccent" ,
   0x07CF: "Greek_OMICRON" ,
   0x07A7: "Greek_OMICRONaccent" ,
   0x07D6: "Greek_PHI" ,
   0x07D0: "Greek_PI" ,
   0x07D8: "Greek_PSI" ,
   0x07D1: "Greek_RHO" ,
   0x07D2: "Greek_SIGMA" ,
   0x07D4: "Greek_TAU" ,
   0x07C8: "Greek_THETA" ,
   0x07D5: "Greek_UPSILON" ,
   0x07A8: "Greek_UPSILONaccent" ,
   0x07A9: "Greek_UPSILONdieresis" ,
   0x07CE: "Greek_XI" ,
   0x07C6: "Greek_ZETA" ,
   0x07AE: "Greek_accentdieresis" ,
   0x07E1: "Greek_alpha" ,
   0x07B1: "Greek_alphaaccent" ,
   0x07E2: "Greek_beta" ,
   0x07F7: "Greek_chi" ,
   0x07E4: "Greek_delta" ,
   0x07E5: "Greek_epsilon" ,
   0x07B2: "Greek_epsilonaccent" ,
   0x07E7: "Greek_eta" ,
   0x07B3: "Greek_etaaccent" ,
   0x07F3: "Greek_finalsmallsigma" ,
   0x07E3: "Greek_gamma" ,
   0x07AF: "Greek_horizbar" ,
   0x07E9: "Greek_iota" ,
   0x07B4: "Greek_iotaaccent" ,
   0x07B6: "Greek_iotaaccentdieresis" ,
   0x07B5: "Greek_iotadieresis" ,
   0x07EA: "Greek_kappa" ,
   0x07EB: "Greek_lambda" ,
   0x07EB: "Greek_lamda" ,
   0x07EC: "Greek_mu" ,
   0x07ED: "Greek_nu" ,
   0x07F9: "Greek_omega" ,
   0x07BB: "Greek_omegaaccent" ,
   0x07EF: "Greek_omicron" ,
   0x07B7: "Greek_omicronaccent" ,
   0x07F6: "Greek_phi" ,
   0x07F0: "Greek_pi" ,
   0x07F8: "Greek_psi" ,
   0x07F1: "Greek_rho" ,
   0x07F2: "Greek_sigma" ,
   0xFF7E: "Greek_switch" ,
   0x07F4: "Greek_tau" ,
   0x07E8: "Greek_theta" ,
   0x07F5: "Greek_upsilon" ,
   0x07B8: "Greek_upsilonaccent" ,
   0x07BA: "Greek_upsilonaccentdieresis" ,
   0x07B9: "Greek_upsilondieresis" ,
   0x07EE: "Greek_xi" ,
   0x07E6: "Greek_zeta" ,
   0x0048: "H" ,
   0xFF31: "Hangul" ,
   0x0EBF: "Hangul_A" ,
   0x0EC0: "Hangul_AE" ,
   0x0EF6: "Hangul_AraeA" ,
   0x0EF7: "Hangul_AraeAE" ,
   0xFF39: "Hangul_Banja" ,
   0x0EBA: "Hangul_Cieuc" ,
   0x0EA7: "Hangul_Dikeud" ,
   0x0EC4: "Hangul_E" ,
   0x0EC3: "Hangul_EO" ,
   0x0ED1: "Hangul_EU" ,
   0xFF33: "Hangul_End" ,
   0xFF34: "Hangul_Hanja" ,
   0x0EBE: "Hangul_Hieuh" ,
   0x0ED3: "Hangul_I" ,
   0x0EB7: "Hangul_Ieung" ,
   0x0EEA: "Hangul_J_Cieuc" ,
   0x0EDA: "Hangul_J_Dikeud" ,
   0x0EEE: "Hangul_J_Hieuh" ,
   0x0EE8: "Hangul_J_Ieung" ,
   0x0EE9: "Hangul_J_Jieuj" ,
   0x0EEB: "Hangul_J_Khieuq" ,
   0x0ED4: "Hangul_J_Kiyeog" ,
   0x0ED6: "Hangul_J_KiyeogSios" ,
   0x0EF9: "Hangul_J_KkogjiDalrinIeung" ,
   0x0EE3: "Hangul_J_Mieum" ,
   0x0ED7: "Hangul_J_Nieun" ,
   0x0ED9: "Hangul_J_NieunHieuh" ,
   0x0ED8: "Hangul_J_NieunJieuj" ,
   0x0EF8: "Hangul_J_PanSios" ,
   0x0EED: "Hangul_J_Phieuf" ,
   0x0EE4: "Hangul_J_Pieub" ,
   0x0EE5: "Hangul_J_PieubSios" ,
   0x0EDB: "Hangul_J_Rieul" ,
   0x0EE2: "Hangul_J_RieulHieuh" ,
   0x0EDC: "Hangul_J_RieulKiyeog" ,
   0x0EDD: "Hangul_J_RieulMieum" ,
   0x0EE1: "Hangul_J_RieulPhieuf" ,
   0x0EDE: "Hangul_J_RieulPieub" ,
   0x0EDF: "Hangul_J_RieulSios" ,
   0x0EE0: "Hangul_J_RieulTieut" ,
   0x0EE6: "Hangul_J_Sios" ,
   0x0ED5: "Hangul_J_SsangKiyeog" ,
   0x0EE7: "Hangul_J_SsangSios" ,
   0x0EEC: "Hangul_J_Tieut" ,
   0x0EFA: "Hangul_J_YeorinHieuh" ,
   0xFF35: "Hangul_Jamo" ,
   0xFF38: "Hangul_Jeonja" ,
   0x0EB8: "Hangul_Jieuj" ,
   0x0EBB: "Hangul_Khieuq" ,
   0x0EA1: "Hangul_Kiyeog" ,
   0x0EA3: "Hangul_KiyeogSios" ,
   0x0EF3: "Hangul_KkogjiDalrinIeung" ,
   0x0EB1: "Hangul_Mieum" ,
   0x0EA4: "Hangul_Nieun" ,
   0x0EA6: "Hangul_NieunHieuh" ,
   0x0EA5: "Hangul_NieunJieuj" ,
   0x0EC7: "Hangul_O" ,
   0x0ECA: "Hangul_OE" ,
   0x0EF2: "Hangul_PanSios" ,
   0x0EBD: "Hangul_Phieuf" ,
   0x0EB2: "Hangul_Pieub" ,
   0x0EB4: "Hangul_PieubSios" ,
   0xFF3B: "Hangul_PostHanja" ,
   0xFF3A: "Hangul_PreHanja" ,
   0x0EA9: "Hangul_Rieul" ,
   0x0EB0: "Hangul_RieulHieuh" ,
   0x0EAA: "Hangul_RieulKiyeog" ,
   0x0EAB: "Hangul_RieulMieum" ,
   0x0EAF: "Hangul_RieulPhieuf" ,
   0x0EAC: "Hangul_RieulPieub" ,
   0x0EAD: "Hangul_RieulSios" ,
   0x0EAE: "Hangul_RieulTieut" ,
   0x0EEF: "Hangul_RieulYeorinHieuh" ,
   0xFF36: "Hangul_Romaja" ,
   0x0EB5: "Hangul_Sios" ,
   0xFF3F: "Hangul_Special" ,
   0x0EA8: "Hangul_SsangDikeud" ,
   0x0EB9: "Hangul_SsangJieuj" ,
   0x0EA2: "Hangul_SsangKiyeog" ,
   0x0EB3: "Hangul_SsangPieub" ,
   0x0EB6: "Hangul_SsangSios" ,
   0xFF32: "Hangul_Start" ,
   0x0EF0: "Hangul_SunkyeongeumMieum" ,
   0x0EF4: "Hangul_SunkyeongeumPhieuf" ,
   0x0EF1: "Hangul_SunkyeongeumPieub" ,
   0x0EBC: "Hangul_Tieut" ,
   0x0ECC: "Hangul_U" ,
   0x0EC8: "Hangul_WA" ,
   0x0EC9: "Hangul_WAE" ,
   0x0ECE: "Hangul_WE" ,
   0x0ECD: "Hangul_WEO" ,
   0x0ECF: "Hangul_WI" ,
   0x0EC1: "Hangul_YA" ,
   0x0EC2: "Hangul_YAE" ,
   0x0EC6: "Hangul_YE" ,
   0x0EC5: "Hangul_YEO" ,
   0x0ED2: "Hangul_YI" ,
   0x0ECB: "Hangul_YO" ,
   0x0ED0: "Hangul_YU" ,
   0x0EF5: "Hangul_YeorinHieuh" ,
   0xFF7E: "Hangul_switch" ,
   0xFF29: "Hankaku" ,
   0x02A6: "Hcircumflex" ,
   0xFF7E: "Hebrew_switch" ,
   0xFF6A: "Help" ,
   0xFF23: "Henkan" ,
   0xFF23: "Henkan_Mode" ,
   0xFF25: "Hiragana" ,
   0xFF27: "Hiragana_Katakana" ,
   0xFF50: "Home" ,
   0x02A1: "Hstroke" ,
   0xFFED: "Hyper_L" ,
   0xFFEE: "Hyper_R" ,
   0x0049: "I" ,
   0xFE33: "ISO_Center_Object" ,
   0xFE30: "ISO_Continuous_Underline" ,
   0xFE31: "ISO_Discontinuous_Underline" ,
   0xFE32: "ISO_Emphasize" ,
   0xFE34: "ISO_Enter" ,
   0xFE2F: "ISO_Fast_Cursor_Down" ,
   0xFE2C: "ISO_Fast_Cursor_Left" ,
   0xFE2D: "ISO_Fast_Cursor_Right" ,
   0xFE2E: "ISO_Fast_Cursor_Up" ,
   0xFE0C: "ISO_First_Group" ,
   0xFE0D: "ISO_First_Group_Lock" ,
   0xFE06: "ISO_Group_Latch" ,
   0xFE07: "ISO_Group_Lock" ,
   0xFF7E: "ISO_Group_Shift" ,
   0xFE0E: "ISO_Last_Group" ,
   0xFE0F: "ISO_Last_Group_Lock" ,
   0xFE20: "ISO_Left_Tab" ,
   0xFE02: "ISO_Level2_Latch" ,
   0xFE04: "ISO_Level3_Latch" ,
   0xFE05: "ISO_Level3_Lock" ,
   0xFE03: "ISO_Level3_Shift" ,
   0xFE01: "ISO_Lock" ,
   0xFE22: "ISO_Move_Line_Down" ,
   0xFE21: "ISO_Move_Line_Up" ,
   0xFE08: "ISO_Next_Group" ,
   0xFE09: "ISO_Next_Group_Lock" ,
   0xFE24: "ISO_Partial_Line_Down" ,
   0xFE23: "ISO_Partial_Line_Up" ,
   0xFE25: "ISO_Partial_Space_Left" ,
   0xFE26: "ISO_Partial_Space_Right" ,
   0xFE0A: "ISO_Prev_Group" ,
   0xFE0B: "ISO_Prev_Group_Lock" ,
   0xFE2B: "ISO_Release_Both_Margins" ,
   0xFE29: "ISO_Release_Margin_Left" ,
   0xFE2A: "ISO_Release_Margin_Right" ,
   0xFE27: "ISO_Set_Margin_Left" ,
   0xFE28: "ISO_Set_Margin_Right" ,
   0x02A9: "Iabovedot" ,
   0x00CD: "Iacute" ,
   0x00CE: "Icircumflex" ,
   0x00CF: "Idiaeresis" ,
   0x00CC: "Igrave" ,
   0x03CF: "Imacron" ,
   0xFF63: "Insert" ,
   0x03C7: "Iogonek" ,
   0x03A5: "Itilde" ,
   0x004A: "J" ,
   0x02AC: "Jcircumflex" ,
   0x004B: "K" ,
   0xFFB0: "KP_0" ,
   0xFFB1: "KP_1" ,
   0xFFB2: "KP_2" ,
   0xFFB3: "KP_3" ,
   0xFFB4: "KP_4" ,
   0xFFB5: "KP_5" ,
   0xFFB6: "KP_6" ,
   0xFFB7: "KP_7" ,
   0xFFB8: "KP_8" ,
   0xFFB9: "KP_9" ,
   0xFFAB: "KP_Add" ,
   0xFF9D: "KP_Begin" ,
   0xFFAE: "KP_Decimal" ,
   0xFF9F: "KP_Delete" ,
   0xFFAF: "KP_Divide" ,
   0xFF99: "KP_Down" ,
   0xFF9C: "KP_End" ,
   0xFF8D: "KP_Enter" ,
   0xFFBD: "KP_Equal" ,
   0xFF91: "KP_F1" ,
   0xFF92: "KP_F2" ,
   0xFF93: "KP_F3" ,
   0xFF94: "KP_F4" ,
   0xFF95: "KP_Home" ,
   0xFF9E: "KP_Insert" ,
   0xFF96: "KP_Left" ,
   0xFFAA: "KP_Multiply" ,
   0xFF9B: "KP_Next" ,
   0xFF9B: "KP_Page_Down" ,
   0xFF9A: "KP_Page_Up" ,
   0xFF9A: "KP_Prior" ,
   0xFF98: "KP_Right" ,
   0xFFAC: "KP_Separator" ,
   0xFF80: "KP_Space" ,
   0xFFAD: "KP_Subtract" ,
   0xFF89: "KP_Tab" ,
   0xFF97: "KP_Up" ,
   0xFF2D: "Kana_Lock" ,
   0xFF2E: "Kana_Shift" ,
   0xFF21: "Kanji" ,
   0xFF26: "Katakana" ,
   0x03D3: "Kcedilla" ,
   0x0EFF: "Korean_Won" ,
   0x004C: "L" ,
   0x01C5: "Lacute" ,
   0xFED4: "Last_Virtual_Screen" ,
   0x01A5: "Lcaron" ,
   0x03A6: "Lcedilla" ,
   0xFF51: "Left" ,
   0xFF0A: "Linefeed" ,
   0x20A4: "LiraSign" ,
   0x01A3: "Lstroke" ,
   0x004D: "M" ,
   0x06B5: "Macedonia_DSE" ,
   0x06B2: "Macedonia_GJE" ,
   0x06BC: "Macedonia_KJE" ,
   0x06A5: "Macedonia_dse" ,
   0x06A2: "Macedonia_gje" ,
   0x06AC: "Macedonia_kje" ,
   0xFF2C: "Massyo" ,
   0xFF67: "Menu" ,
   0xFFE7: "Meta_L" ,
   0xFFE8: "Meta_R" ,
   0x20A5: "MillSign" ,
   0xFF7E: "Mode_switch" ,
   0xFE77: "MouseKeys_Accel_Enable" ,
   0xFE76: "MouseKeys_Enable" ,
   0xFF22: "Muhenkan" ,
   0xFF20: "Multi_key" ,
   0xFF3D: "MultipleCandidate" ,
   0x004E: "N" ,
   0x01D1: "Nacute" ,
   0x20A6: "NairaSign" ,
   0x01D2: "Ncaron" ,
   0x03D1: "Ncedilla" ,
   0x20AA: "NewSheqelSign" ,
   0xFF56: "Next" ,
   0xFED2: "Next_Virtual_Screen" ,
   0x00D1: "Ntilde" ,
   0xFF7F: "Num_Lock" ,
   0x004F: "O" ,
   0x13BC: "OE" ,
   0x00D3: "Oacute" ,
   0x00D4: "Ocircumflex" ,
   0x00D6: "Odiaeresis" ,
   0x01D5: "Odoubleacute" ,
   0x00D2: "Ograve" ,
   0x1EFA: "Ohorn" ,
   0x03D2: "Omacron" ,
   0x00D8: "Ooblique" ,
   0x00D5: "Otilde" ,
   0xFE78: "Overlay1_Enable" ,
   0xFE79: "Overlay2_Enable" ,
   0x0050: "P" ,
   0xFF56: "Page_Down" ,
   0xFF55: "Page_Up" ,
   0xFF13: "Pause" ,
   0x20A7: "PesetaSign" ,
   0xFEFA: "Pointer_Accelerate" ,
   0xFEE9: "Pointer_Button1" ,
   0xFEEA: "Pointer_Button2" ,
   0xFEEB: "Pointer_Button3" ,
   0xFEEC: "Pointer_Button4" ,
   0xFEED: "Pointer_Button5" ,
   0xFEE8: "Pointer_Button_Dflt" ,
   0xFEEF: "Pointer_DblClick1" ,
   0xFEF0: "Pointer_DblClick2" ,
   0xFEF1: "Pointer_DblClick3" ,
   0xFEF2: "Pointer_DblClick4" ,
   0xFEF3: "Pointer_DblClick5" ,
   0xFEEE: "Pointer_DblClick_Dflt" ,
   0xFEFB: "Pointer_DfltBtnNext" ,
   0xFEFC: "Pointer_DfltBtnPrev" ,
   0xFEE3: "Pointer_Down" ,
   0xFEE6: "Pointer_DownLeft" ,
   0xFEE7: "Pointer_DownRight" ,
   0xFEF5: "Pointer_Drag1" ,
   0xFEF6: "Pointer_Drag2" ,
   0xFEF7: "Pointer_Drag3" ,
   0xFEF8: "Pointer_Drag4" ,
   0xFEFD: "Pointer_Drag5" ,
   0xFEF4: "Pointer_Drag_Dflt" ,
   0xFEF9: "Pointer_EnableKeys" ,
   0xFEE0: "Pointer_Left" ,
   0xFEE1: "Pointer_Right" ,
   0xFEE2: "Pointer_Up" ,
   0xFEE4: "Pointer_UpLeft" ,
   0xFEE5: "Pointer_UpRight" ,
   0xFED1: "Prev_Virtual_Screen" ,
   0xFF3E: "PreviousCandidate" ,
   0xFF61: "Print" ,
   0xFF55: "Prior" ,
   0x0051: "Q" ,
   0x0052: "R" ,
   0x01C0: "Racute" ,
   0x01D8: "Rcaron" ,
   0x03A3: "Rcedilla" ,
   0xFF66: "Redo" ,
   0xFE72: "RepeatKeys_Enable" ,
   0xFF0D: "Return" ,
   0xFF53: "Right" ,
   0xFF24: "Romaji" ,
   0x20A8: "RupeeSign" ,
   0x0053: "S" ,
   0x01A6: "Sacute" ,
   0x01A9: "Scaron" ,
   0x01AA: "Scedilla" ,
   0x02DE: "Scircumflex" ,
   0xFF14: "Scroll_Lock" ,
   0xFF60: "Select" ,
   0x06B1: "Serbian_DJE" ,
   0x06BF: "Serbian_DZE" ,
   0x06B8: "Serbian_JE" ,
   0x06B9: "Serbian_LJE" ,
   0x06BA: "Serbian_NJE" ,
   0x06BB: "Serbian_TSHE" ,
   0x06A1: "Serbian_dje" ,
   0x06AF: "Serbian_dze" ,
   0x06A8: "Serbian_je" ,
   0x06A9: "Serbian_lje" ,
   0x06AA: "Serbian_nje" ,
   0x06AB: "Serbian_tshe" ,
   0xFFE1: "Shift_L" ,
   0xFFE6: "Shift_Lock" ,
   0xFFE2: "Shift_R" ,
   0xFF3C: "SingleCandidate" ,
   0xFE73: "SlowKeys_Enable" ,
   0xFE75: "StickyKeys_Enable" ,
   0xFFEB: "Super_L" ,
   0xFFEC: "Super_R" ,
   0xFF15: "Sys_Req" ,
   0x0054: "T" ,
   0x00DE: "THORN" ,
   0xFF09: "Tab" ,
   0x01AB: "Tcaron" ,
   0x01DE: "Tcedilla" ,
   0xFED5: "Terminate_Server" ,
   0x0DDF: "Thai_baht" ,
   0x0DBA: "Thai_bobaimai" ,
   0x0DA8: "Thai_chochan" ,
   0x0DAA: "Thai_chochang" ,
   0x0DA9: "Thai_choching" ,
   0x0DAC: "Thai_chochoe" ,
   0x0DAE: "Thai_dochada" ,
   0x0DB4: "Thai_dodek" ,
   0x0DBD: "Thai_fofa" ,
   0x0DBF: "Thai_fofan" ,
   0x0DCB: "Thai_hohip" ,
   0x0DCE: "Thai_honokhuk" ,
   0x0DA2: "Thai_khokhai" ,
   0x0DA5: "Thai_khokhon" ,
   0x0DA3: "Thai_khokhuat" ,
   0x0DA4: "Thai_khokhwai" ,
   0x0DA6: "Thai_khorakhang" ,
   0x0DA1: "Thai_kokai" ,
   0x0DE5: "Thai_lakkhangyao" ,
   0x0DF7: "Thai_lekchet" ,
   0x0DF5: "Thai_lekha" ,
   0x0DF6: "Thai_lekhok" ,
   0x0DF9: "Thai_lekkao" ,
   0x0DF1: "Thai_leknung" ,
   0x0DF8: "Thai_lekpaet" ,
   0x0DF3: "Thai_leksam" ,
   0x0DF4: "Thai_leksi" ,
   0x0DF2: "Thai_leksong" ,
   0x0DF0: "Thai_leksun" ,
   0x0DCC: "Thai_lochula" ,
   0x0DC5: "Thai_loling" ,
   0x0DC6: "Thai_lu" ,
   0x0DEB: "Thai_maichattawa" ,
   0x0DE8: "Thai_maiek" ,
   0x0DD1: "Thai_maihanakat" ,
   0x0DDE: "Thai_maihanakat_maitho" ,
   0x0DE7: "Thai_maitaikhu" ,
   0x0DE9: "Thai_maitho" ,
   0x0DEA: "Thai_maitri" ,
   0x0DE6: "Thai_maiyamok" ,
   0x0DC1: "Thai_moma" ,
   0x0DA7: "Thai_ngongu" ,
   0x0DED: "Thai_nikhahit" ,
   0x0DB3: "Thai_nonen" ,
   0x0DB9: "Thai_nonu" ,
   0x0DCD: "Thai_oang" ,
   0x0DCF: "Thai_paiyannoi" ,
   0x0DDA: "Thai_phinthu" ,
   0x0DBE: "Thai_phophan" ,
   0x0DBC: "Thai_phophung" ,
   0x0DC0: "Thai_phosamphao" ,
   0x0DBB: "Thai_popla" ,
   0x0DC3: "Thai_rorua" ,
   0x0DC4: "Thai_ru" ,
   0x0DD0: "Thai_saraa" ,
   0x0DD2: "Thai_saraaa" ,
   0x0DE1: "Thai_saraae" ,
   0x0DE4: "Thai_saraaimaimalai" ,
   0x0DE3: "Thai_saraaimaimuan" ,
   0x0DD3: "Thai_saraam" ,
   0x0DE0: "Thai_sarae" ,
   0x0DD4: "Thai_sarai" ,
   0x0DD5: "Thai_saraii" ,
   0x0DE2: "Thai_sarao" ,
   0x0DD8: "Thai_sarau" ,
   0x0DD6: "Thai_saraue" ,
   0x0DD7: "Thai_sarauee" ,
   0x0DD9: "Thai_sarauu" ,
   0x0DC9: "Thai_sorusi" ,
   0x0DC8: "Thai_sosala" ,
   0x0DAB: "Thai_soso" ,
   0x0DCA: "Thai_sosua" ,
   0x0DEC: "Thai_thanthakhat" ,
   0x0DB1: "Thai_thonangmontho" ,
   0x0DB2: "Thai_thophuthao" ,
   0x0DB7: "Thai_thothahan" ,
   0x0DB0: "Thai_thothan" ,
   0x0DB8: "Thai_thothong" ,
   0x0DB6: "Thai_thothung" ,
   0x0DAF: "Thai_topatak" ,
   0x0DB5: "Thai_totao" ,
   0x0DC7: "Thai_wowaen" ,
   0x0DC2: "Thai_yoyak" ,
   0x0DAD: "Thai_yoying" ,
   0x00DE: "Thorn" ,
   0xFF2B: "Touroku" ,
   0x03AC: "Tslash" ,
   0x0055: "U" ,
   0x00DA: "Uacute" ,
   0x02DD: "Ubreve" ,
   0x00DB: "Ucircumflex" ,
   0x00DC: "Udiaeresis" ,
   0x01DB: "Udoubleacute" ,
   0x00D9: "Ugrave" ,
   0x1EFC: "Uhorn" ,
   0x06B6: "Ukrainian_I" ,
   0x06B4: "Ukrainian_IE" ,
   0x06B7: "Ukrainian_YI" ,
   0x06A6: "Ukrainian_i" ,
   0x06A4: "Ukrainian_ie" ,
   0x06A7: "Ukrainian_yi" ,
   0x06B6: "Ukranian_I" ,
   0x06B4: "Ukranian_JE" ,
   0x06B7: "Ukranian_YI" ,
   0x06A6: "Ukranian_i" ,
   0x06A4: "Ukranian_je" ,
   0x06A7: "Ukranian_yi" ,
   0x03DE: "Umacron" ,
   0xFF65: "Undo" ,
   0x03D9: "Uogonek" ,
   0xFF52: "Up" ,
   0x01D9: "Uring" ,
   0x03DD: "Utilde" ,
   0x0056: "V" ,
   0x0057: "W" ,
   0x20A9: "WonSign" ,
   0x0058: "X" ,
   0x0059: "Y" ,
   0x00DD: "Yacute" ,
   0x13BE: "Ydiaeresis" ,
   0x005A: "Z" ,
   0x01AF: "Zabovedot" ,
   0x01AC: "Zacute" ,
   0x01AE: "Zcaron" ,
   0xFF28: "Zenkaku" ,
   0xFF2A: "Zenkaku_Hankaku" ,
   0x0061: "a" ,
   0x00E1: "aacute" ,
   0x01FF: "abovedot" ,
   0x01E3: "abreve" ,
   0x00E2: "acircumflex" ,
   0x00B4: "acute" ,
   0x00E4: "adiaeresis" ,
   0x00E6: "ae" ,
   0x00E0: "agrave" ,
   0x03E0: "amacron" ,
   0x0026: "ampersand" ,
   0x01B1: "aogonek" ,
   0x0027: "apostrophe" ,
   0x08C8: "approximate" ,
   0x00E5: "aring" ,
   0x005E: "asciicircum" ,
   0x007E: "asciitilde" ,
   0x002A: "asterisk" ,
   0x0040: "at" ,
   0x00E3: "atilde" ,
   0x0062: "b" ,
   0x005C: "backslash" ,
   0x0AF4: "ballotcross" ,
   0x007C: "bar" ,
   0x09DF: "blank" ,
   0x08A5: "botintegral" ,
   0x08AC: "botleftparens" ,
   0x08A8: "botleftsqbracket" ,
   0x08B2: "botleftsummation" ,
   0x08AE: "botrightparens" ,
   0x08AA: "botrightsqbracket" ,
   0x08B6: "botrightsummation" ,
   0x09F6: "bott" ,
   0x08B4: "botvertsummationconnector" ,
   0x007B: "braceleft" ,
   0x007D: "braceright" ,
   0x005B: "bracketleft" ,
   0x005D: "bracketright" ,
   0x01A2: "breve" ,
   0x00A6: "brokenbar" ,
   0x0063: "c" ,
   0x02E5: "cabovedot" ,
   0x01E6: "cacute" ,
   0x0AB8: "careof" ,
   0x0AFC: "caret" ,
   0x01B7: "caron" ,
   0x01E8: "ccaron" ,
   0x00E7: "ccedilla" ,
   0x02E6: "ccircumflex" ,
   0x00B8: "cedilla" ,
   0x00A2: "cent" ,
   0x09E1: "checkerboard" ,
   0x0AF3: "checkmark" ,
   0x0BCF: "circle" ,
   0x0AEC: "club" ,
   0x003A: "colon" ,
   0x1EF3: "combining_acute" ,
   0x1EFF: "combining_belowdot" ,
   0x1EF2: "combining_grave" ,
   0x1EFE: "combining_hook" ,
   0x1E9F: "combining_tilde" ,
   0x002C: "comma" ,
   0x00A9: "copyright" ,
   0x09E4: "cr" ,
   0x09EE: "crossinglines" ,
   0x00A4: "currency" ,
   0x0AFF: "cursor" ,
   0x0064: "d" ,
   0x0AF1: "dagger" ,
   0x01EF: "dcaron" ,
   0xFE56: "dead_abovedot" ,
   0xFE58: "dead_abovering" ,
   0xFE51: "dead_acute" ,
   0xFE60: "dead_belowdot" ,
   0xFE55: "dead_breve" ,
   0xFE5A: "dead_caron" ,
   0xFE5B: "dead_cedilla" ,
   0xFE52: "dead_circumflex" ,
   0xFE57: "dead_diaeresis" ,
   0xFE59: "dead_doubleacute" ,
   0xFE50: "dead_grave" ,
   0xFE61: "dead_hook" ,
   0xFE62: "dead_horn" ,
   0xFE5D: "dead_iota" ,
   0xFE54: "dead_macron" ,
   0xFE5C: "dead_ogonek" ,
   0xFE5F: "dead_semivoiced_sound" ,
   0xFE53: "dead_tilde" ,
   0xFE5E: "dead_voiced_sound" ,
   0x0ABD: "decimalpoint" ,
   0x00B0: "degree" ,
   0x00A8: "diaeresis" ,
   0x0AED: "diamond" ,
   0x0AA5: "digitspace" ,
   0x00F7: "division" ,
   0x0024: "dollar" ,
   0x0AAF: "doubbaselinedot" ,
   0x01BD: "doubleacute" ,
   0x0AF2: "doubledagger" ,
   0x0AFE: "doublelowquotemark" ,
   0x08FE: "downarrow" ,
   0x0BA8: "downcaret" ,
   0x0BD6: "downshoe" ,
   0x0BC4: "downstile" ,
   0x0BC2: "downtack" ,
   0x01F0: "dstroke" ,
   0x0065: "e" ,
   0x03EC: "eabovedot" ,
   0x00E9: "eacute" ,
   0x01EC: "ecaron" ,
   0x00EA: "ecircumflex" ,
   0x00EB: "ediaeresis" ,
   0x00E8: "egrave" ,
   0x0AAE: "ellipsis" ,
   0x0AA3: "em3space" ,
   0x0AA4: "em4space" ,
   0x03BA: "emacron" ,
   0x0AA9: "emdash" ,
   0x0ADE: "emfilledcircle" ,
   0x0ADF: "emfilledrect" ,
   0x0ACE: "emopencircle" ,
   0x0ACF: "emopenrectangle" ,
   0x0AA1: "emspace" ,
   0x0AAA: "endash" ,
   0x0AE6: "enfilledcircbullet" ,
   0x0AE7: "enfilledsqbullet" ,
   0x03BF: "eng" ,
   0x0AE0: "enopencircbullet" ,
   0x0AE1: "enopensquarebullet" ,
   0x0AA2: "enspace" ,
   0x01EA: "eogonek" ,
   0x003D: "equal" ,
   0x00F0: "eth" ,
   0x0021: "exclam" ,
   0x00A1: "exclamdown" ,
   0x0066: "f" ,
   0x0AF8: "femalesymbol" ,
   0x09E3: "ff" ,
   0x0ABB: "figdash" ,
   0x0ADC: "filledlefttribullet" ,
   0x0ADB: "filledrectbullet" ,
   0x0ADD: "filledrighttribullet" ,
   0x0AE9: "filledtribulletdown" ,
   0x0AE8: "filledtribulletup" ,
   0x0AC5: "fiveeighths" ,
   0x0AB7: "fivesixths" ,
   0x0AB5: "fourfifths" ,
   0x08F6: "function" ,
   0x0067: "g" ,
   0x02F5: "gabovedot" ,
   0x02BB: "gbreve" ,
   0x03BB: "gcedilla" ,
   0x02F8: "gcircumflex" ,
   0x0060: "grave" ,
   0x003E: "greater" ,
   0x08BE: "greaterthanequal" ,
   0x00AB: "guillemotleft" ,
   0x00BB: "guillemotright" ,
   0x0068: "h" ,
   0x0AA8: "hairspace" ,
   0x02B6: "hcircumflex" ,
   0x0AEE: "heart" ,
   0x0CE0: "hebrew_aleph" ,
   0x0CF2: "hebrew_ayin" ,
   0x0CE1: "hebrew_bet" ,
   0x0CE1: "hebrew_beth" ,
   0x0CE7: "hebrew_chet" ,
   0x0CE3: "hebrew_dalet" ,
   0x0CE3: "hebrew_daleth" ,
   0x0CDF: "hebrew_doublelowline" ,
   0x0CEA: "hebrew_finalkaph" ,
   0x0CED: "hebrew_finalmem" ,
   0x0CEF: "hebrew_finalnun" ,
   0x0CF3: "hebrew_finalpe" ,
   0x0CF5: "hebrew_finalzade" ,
   0x0CF5: "hebrew_finalzadi" ,
   0x0CE2: "hebrew_gimel" ,
   0x0CE2: "hebrew_gimmel" ,
   0x0CE4: "hebrew_he" ,
   0x0CE7: "hebrew_het" ,
   0x0CEB: "hebrew_kaph" ,
   0x0CF7: "hebrew_kuf" ,
   0x0CEC: "hebrew_lamed" ,
   0x0CEE: "hebrew_mem" ,
   0x0CF0: "hebrew_nun" ,
   0x0CF4: "hebrew_pe" ,
   0x0CF7: "hebrew_qoph" ,
   0x0CF8: "hebrew_resh" ,
   0x0CF1: "hebrew_samech" ,
   0x0CF1: "hebrew_samekh" ,
   0x0CF9: "hebrew_shin" ,
   0x0CFA: "hebrew_taf" ,
   0x0CFA: "hebrew_taw" ,
   0x0CE8: "hebrew_tet" ,
   0x0CE8: "hebrew_teth" ,
   0x0CE5: "hebrew_waw" ,
   0x0CE9: "hebrew_yod" ,
   0x0CF6: "hebrew_zade" ,
   0x0CF6: "hebrew_zadi" ,
   0x0CE6: "hebrew_zain" ,
   0x0CE6: "hebrew_zayin" ,
   0x0ADA: "hexagram" ,
   0x08A3: "horizconnector" ,
   0x09EF: "horizlinescan1" ,
   0x09F0: "horizlinescan3" ,
   0x09F1: "horizlinescan5" ,
   0x09F2: "horizlinescan7" ,
   0x09F3: "horizlinescan9" ,
   0x02B1: "hstroke" ,
   0x09E2: "ht" ,
   0x00AD: "hyphen" ,
   0x0069: "i" ,
   0x00ED: "iacute" ,
   0x00EE: "icircumflex" ,
   0x08CF: "identical" ,
   0x00EF: "idiaeresis" ,
   0x02B9: "idotless" ,
   0x08CD: "ifonlyif" ,
   0x00EC: "igrave" ,
   0x03EF: "imacron" ,
   0x08CE: "implies" ,
   0x08DA: "includedin" ,
   0x08DB: "includes" ,
   0x08C2: "infinity" ,
   0x08BF: "integral" ,
   0x08DC: "intersection" ,
   0x03E7: "iogonek" ,
   0x03B5: "itilde" ,
   0x006A: "j" ,
   0x02BC: "jcircumflex" ,
   0x0BCA: "jot" ,
   0x006B: "k" ,
   0x04B1: "kana_A" ,
   0x04C1: "kana_CHI" ,
   0x04B4: "kana_E" ,
   0x04CC: "kana_FU" ,
   0x04CA: "kana_HA" ,
   0x04CD: "kana_HE" ,
   0x04CB: "kana_HI" ,
   0x04CE: "kana_HO" ,
   0x04CC: "kana_HU" ,
   0x04B2: "kana_I" ,
   0x04B6: "kana_KA" ,
   0x04B9: "kana_KE" ,
   0x04B7: "kana_KI" ,
   0x04BA: "kana_KO" ,
   0x04B8: "kana_KU" ,
   0x04CF: "kana_MA" ,
   0x04D2: "kana_ME" ,
   0x04D0: "kana_MI" ,
   0x04D3: "kana_MO" ,
   0x04D1: "kana_MU" ,
   0x04DD: "kana_N" ,
   0x04C5: "kana_NA" ,
   0x04C8: "kana_NE" ,
   0x04C6: "kana_NI" ,
   0x04C9: "kana_NO" ,
   0x04C7: "kana_NU" ,
   0x04B5: "kana_O" ,
   0x04D7: "kana_RA" ,
   0x04DA: "kana_RE" ,
   0x04D8: "kana_RI" ,
   0x04DB: "kana_RO" ,
   0x04D9: "kana_RU" ,
   0x04BB: "kana_SA" ,
   0x04BE: "kana_SE" ,
   0x04BC: "kana_SHI" ,
   0x04BF: "kana_SO" ,
   0x04BD: "kana_SU" ,
   0x04C0: "kana_TA" ,
   0x04C3: "kana_TE" ,
   0x04C1: "kana_TI" ,
   0x04C4: "kana_TO" ,
   0x04C2: "kana_TSU" ,
   0x04C2: "kana_TU" ,
   0x04B3: "kana_U" ,
   0x04DC: "kana_WA" ,
   0x04A6: "kana_WO" ,
   0x04D4: "kana_YA" ,
   0x04D6: "kana_YO" ,
   0x04D5: "kana_YU" ,
   0x04A7: "kana_a" ,
   0x04A3: "kana_closingbracket" ,
   0x04A4: "kana_comma" ,
   0x04A5: "kana_conjunctive" ,
   0x04AA: "kana_e" ,
   0x04A1: "kana_fullstop" ,
   0x04A8: "kana_i" ,
   0x04A5: "kana_middledot" ,
   0x04AB: "kana_o" ,
   0x04A2: "kana_openingbracket" ,
   0xFF7E: "kana_switch" ,
   0x04AF: "kana_tsu" ,
   0x04AF: "kana_tu" ,
   0x04A9: "kana_u" ,
   0x04AC: "kana_ya" ,
   0x04AE: "kana_yo" ,
   0x04AD: "kana_yu" ,
   0x03A2: "kappa" ,
   0x03F3: "kcedilla" ,
   0x03A2: "kra" ,
   0x006C: "l" ,
   0x01E5: "lacute" ,
   0x0AD9: "latincross" ,
   0x01B5: "lcaron" ,
   0x03B6: "lcedilla" ,
   0x0ABC: "leftanglebracket" ,
   0x08FB: "leftarrow" ,
   0x0BA3: "leftcaret" ,
   0x0AD2: "leftdoublequotemark" ,
   0x08AF: "leftmiddlecurlybrace" ,
   0x0ACC: "leftopentriangle" ,
   0x0AEA: "leftpointer" ,
   0x08A1: "leftradical" ,
   0x0BDA: "leftshoe" ,
   0x0AD0: "leftsinglequotemark" ,
   0x09F4: "leftt" ,
   0x0BDC: "lefttack" ,
   0x003C: "less" ,
   0x08BC: "lessthanequal" ,
   0x09E5: "lf" ,
   0x08DE: "logicaland" ,
   0x08DF: "logicalor" ,
   0x09ED: "lowleftcorner" ,
   0x09EA: "lowrightcorner" ,
   0x01B3: "lstroke" ,
   0x006D: "m" ,
   0x00AF: "macron" ,
   0x0AF7: "malesymbol" ,
   0x0AF0: "maltesecross" ,
   0x0ABF: "marker" ,
   0x00BA: "masculine" ,
   0x002D: "minus" ,
   0x0AD6: "minutes" ,
   0x00B5: "mu" ,
   0x00D7: "multiply" ,
   0x0AF6: "musicalflat" ,
   0x0AF5: "musicalsharp" ,
   0x006E: "n" ,
   0x08C5: "nabla" ,
   0x01F1: "nacute" ,
   0x01F2: "ncaron" ,
   0x03F1: "ncedilla" ,
   0x09E8: "nl" ,
   0x00A0: "nobreakspace" ,
   0x08BD: "notequal" ,
   0x00AC: "notsign" ,
   0x00F1: "ntilde" ,
   0x0023: "numbersign" ,
   0x06B0: "numerosign" ,
   0x006F: "o" ,
   0x00F3: "oacute" ,
   0x00F4: "ocircumflex" ,
   0x00F6: "odiaeresis" ,
   0x01F5: "odoubleacute" ,
   0x13BD: "oe" ,
   0x01B2: "ogonek" ,
   0x00F2: "ograve" ,
   0x1EFB: "ohorn" ,
   0x03F2: "omacron" ,
   0x0AC3: "oneeighth" ,
   0x0AB2: "onefifth" ,
   0x00BD: "onehalf" ,
   0x00BC: "onequarter" ,
   0x0AB6: "onesixth" ,
   0x00B9: "onesuperior" ,
   0x0AB0: "onethird" ,
   0x0AE2: "openrectbullet" ,
   0x0AE5: "openstar" ,
   0x0AE4: "opentribulletdown" ,
   0x0AE3: "opentribulletup" ,
   0x00AA: "ordfeminine" ,
   0x00F8: "oslash" ,
   0x00F5: "otilde" ,
   0x0BC0: "overbar" ,
   0x047E: "overline" ,
   0x0070: "p" ,
   0x00B6: "paragraph" ,
   0x0028: "parenleft" ,
   0x0029: "parenright" ,
   0x08EF: "partialderivative" ,
   0x0025: "percent" ,
   0x002E: "period" ,
   0x00B7: "periodcentered" ,
   0x0AFB: "phonographcopyright" ,
   0x002B: "plus" ,
   0x00B1: "plusminus" ,
   0x0AD4: "prescription" ,
   0x04B0: "prolongedsound" ,
   0x0AA6: "punctspace" ,
   0x0071: "q" ,
   0x0BCC: "quad" ,
   0x003F: "question" ,
   0x00BF: "questiondown" ,
   0x0022: "quotedbl" ,
   0x0060: "quoteleft" ,
   0x0027: "quoteright" ,
   0x0072: "r" ,
   0x01E0: "racute" ,
   0x08D6: "radical" ,
   0x01F8: "rcaron" ,
   0x03B3: "rcedilla" ,
   0x00AE: "registered" ,
   0x0ABE: "rightanglebracket" ,
   0x08FD: "rightarrow" ,
   0x0BA6: "rightcaret" ,
   0x0AD3: "rightdoublequotemark" ,
   0x08B0: "rightmiddlecurlybrace" ,
   0x08B7: "rightmiddlesummation" ,
   0x0ACD: "rightopentriangle" ,
   0x0AEB: "rightpointer" ,
   0x0BD8: "rightshoe" ,
   0x0AD1: "rightsinglequotemark" ,
   0x09F5: "rightt" ,
   0x0BFC: "righttack" ,
   0x0073: "s" ,
   0x01B6: "sacute" ,
   0x01B9: "scaron" ,
   0x01BA: "scedilla" ,
   0x02FE: "scircumflex" ,
   0xFF7E: "script_switch" ,
   0x0AD7: "seconds" ,
   0x00A7: "section" ,
   0x003B: "semicolon" ,
   0x04DF: "semivoicedsound" ,
   0x0AC6: "seveneighths" ,
   0x0ACA: "signaturemark" ,
   0x0AAC: "signifblank" ,
   0x08C9: "similarequal" ,
   0x0AFD: "singlelowquotemark" ,
   0x002F: "slash" ,
   0x09E0: "soliddiamond" ,
   0x0020: "space" ,
   0x00DF: "ssharp" ,
   0x00A3: "sterling" ,
   0x0074: "t" ,
   0x01BB: "tcaron" ,
   0x01FE: "tcedilla" ,
   0x0AF9: "telephone" ,
   0x0AFA: "telephonerecorder" ,
   0x08C0: "therefore" ,
   0x0AA7: "thinspace" ,
   0x00FE: "thorn" ,
   0x0AC4: "threeeighths" ,
   0x0AB4: "threefifths" ,
   0x00BE: "threequarters" ,
   0x00B3: "threesuperior" ,
   0x08A4: "topintegral" ,
   0x08AB: "topleftparens" ,
   0x08A2: "topleftradical" ,
   0x08A7: "topleftsqbracket" ,
   0x08B1: "topleftsummation" ,
   0x08AD: "toprightparens" ,
   0x08A9: "toprightsqbracket" ,
   0x08B5: "toprightsummation" ,
   0x09F7: "topt" ,
   0x08B3: "topvertsummationconnector" ,
   0x0AC9: "trademark" ,
   0x0ACB: "trademarkincircle" ,
   0x03BC: "tslash" ,
   0x0AB3: "twofifths" ,
   0x00B2: "twosuperior" ,
   0x0AB1: "twothirds" ,
   0x0075: "u" ,
   0x00FA: "uacute" ,
   0x02FD: "ubreve" ,
   0x00FB: "ucircumflex" ,
   0x00FC: "udiaeresis" ,
   0x01FB: "udoubleacute" ,
   0x00F9: "ugrave" ,
   0x1EFD: "uhorn" ,
   0x03FE: "umacron" ,
   0x0BC6: "underbar" ,
   0x005F: "underscore" ,
   0x08DD: "union" ,
   0x03F9: "uogonek" ,
   0x08FC: "uparrow" ,
   0x0BA9: "upcaret" ,
   0x09EC: "upleftcorner" ,
   0x09EB: "uprightcorner" ,
   0x0BC3: "upshoe" ,
   0x0BD3: "upstile" ,
   0x0BCE: "uptack" ,
   0x01F9: "uring" ,
   0x03FD: "utilde" ,
   0x0076: "v" ,
   0x08C1: "variation" ,
   0x09F8: "vertbar" ,
   0x08A6: "vertconnector" ,
   0x04DE: "voicedsound" ,
   0x09E9: "vt" ,
   0x0077: "w" ,
   0x0078: "x" ,
   0x0079: "y" ,
   0x00FD: "yacute" ,
   0x00FF: "ydiaeresis" ,
   0x00A5: "yen" ,
   0x007A: "z" ,
   0x01BF: "zabovedot" ,
   0x01BC: "zacute" ,
   0x01BE: "zcaron" 
              }
def get_key_name(key):
    name=''
    try:
        name=key_name_map[key]
    except KeyError,e:
        try:
            key=key | 0xff00
            name=key_name_map[key]
        except KeyError,e:
            try:
                key=key | 0x0800
                name=key_name_map[key]
            except KeyError,e:
                pass
    return name       
if __name__=='__main__':
    manager=Method_input_manager() 
    print ' '.join(manager.get_factory_name(factory)for factory in manager.get_factory_list_for_language()) 
    uuid=manager.get_default_factory()
    instance=manager.new_instance(uuid)
    instance.add_signal_listener(Sample_listener())
    
    print instance.get_name(), instance.id
    

    
    instance.focus_in()
    
    print instance.process_key_event('a');
    print instance.process_key_event('n');
    print instance.process_key_event('q');
    print instance.process_key_event('u');
    print instance.process_key_event('n');
    
    instance.close()
    
    del instance